package com.wc.fortnight_blue_bridge.Q16模拟二.A_质因数;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/11/23 21:26
 * @description
 * https://dasai.lanqiao.cn/pages/v7/dasai/prelim/prelim_examing.html?examUsperPaperId=338843&applyId=579285787961
 */
public class Main {
    /**
     * 【问题描述】
     * 如果一个数 p 是个质数，同时又是整数 a 的约数，则 p 称为 a 的一个质因数。
     * 请问， 2024 的最大的质因数是多少？
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 2024;
    static int n = 2024;

    public static void main(String[] args) {
        int res = -1;
        for(int i = 2; i <= n; i++){
            if (n % i == 0 && isPrim(i)) res = i;
        }
        out.println(res);
        out.flush();
    }

    static boolean isPrim(int x){
        if (x < 2) return false;
        for(int i = 2; i * i <= x; i++){
            if (x % i == 0) return false;
        }
        return true;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

